﻿<UserControl x:Class="SH.Client.WPF.DesignData.MainWindowView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="200" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>


        <GridSplitter Grid.Row="1" 
                          HorizontalAlignment="Stretch" 
                          VerticalAlignment="Top" 
                          ShowsPreview="true"
                          ResizeDirection="Rows"
                          Height="5"
                      >
            <GridSplitter.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FF3A3232" Offset="0.494"/>
                    <GradientStop Color="White" Offset="1"/>
                    <GradientStop Color="White"/>
                </LinearGradientBrush>
            </GridSplitter.Background>
        </GridSplitter>


        <!-- This ListView displays the all the customer information -->
        <ListView Grid.Row="0" Name="ListViewCustomers"  
                  ItemsSource="{Binding Path=Storehauses, PresentationTraceSources.TraceLevel=High}"
                  IsSynchronizedWithCurrentItem="True"
                  SelectedIndex="2"
                  >
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="Реєстраційний номер" DisplayMemberBinding="{Binding Id}"/>
                    <GridViewColumn Header="Код ЄДРПОУ" DisplayMemberBinding="{Binding Edrpou}" Width="100"/>
                    <GridViewColumn Header="Назва" DisplayMemberBinding="{Binding Name}" Width="200"/>
                    <GridViewColumn Header="Місткість" DisplayMemberBinding="{Binding Capacity}"/>
                </GridView>
            </ListView.View>
        </ListView>
      

        <!-- This ListView displayd the corresponding order information for the selected customer in the customers ListView -->
        <!-- Put attention to the ItemSource property, its the key point of this kind of master/detail data binding -->
        <ListView Grid.Row="2"
                  ItemsSource="{Binding ElementName=ListViewCustomers, Path=SelectedItem.Certificates, PresentationTraceSources.TraceLevel=High}"
                  >
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="№" DisplayMemberBinding="{Binding Id}" Width="50"/>
                    <GridViewColumn Header="Діє з" DisplayMemberBinding="{Binding DateStart}" Width="auto"/>
                    <GridViewColumn Header="Діє по" DisplayMemberBinding="{Binding DateEnd}" Width="auto"/>
                    <GridViewColumn Header="Статус" DisplayMemberBinding="{Binding Status.Name}" Width="auto"/>
                </GridView>
            </ListView.View>
        </ListView>
    </Grid>
</UserControl>
